function accuracy = Test2DPCA(numOfPeople, trainFaces, projection, allprojectionFace, T, jbeg, jend)
right = 0;
for i = 1:numOfPeople
    for j = jbeg:jend
        TD = zeros(28,23);        
        TD(:,:) = T(i,j,:,:);
        afterProjection = TD * projection;
        error = zeros(trainFaces * numOfPeople,1);
        for ti=1:trainFaces * numOfPeople
            miss = afterProjection - allprojectionFace(:,:,ti);
            for tj=1:size(miss,2)
                error(ti) = error(ti)+norm(miss(:,tj),1);
            end
        end
        [errorS,errorIndex] = sort(error);
        class = floor((errorIndex(1)-1)/trainFaces)+1;
        if class == i
            right = right + 1;
        end
    end
end
accuracy = right/(numOfPeople*(jend-jbeg + 1));
end